<template>
  <j-modal
    :title="title"
    :width="800"
    :visible="visible"
    :maskClosable="false"
    :ok-button-props="{ props: { disabled: disableSubmit } }"
    :fullscreen="true"
    @close="close"
    cancelText="关闭"
  >
    <div :class="{ isCheck: isCheck }">
      <!-- <div class="table-header">
        <span class="table-title">审计负责人：</span>{{ model.headName }} <span class="table-title">填表人：</span
        >{{ model.realName }} <span class="table-title">填表时间：</span>{{ model.addDate }}
        <span class="table-title">统计时间：</span>{{ model.year }}年（{{ model.quarter }}季度）
      </div> -->
      <a-table
        class="edit-list"
        ref="table"
        size="middle"
        bordered
        width="100vw"
        :pagination="false"
        :columns="columns"
        :dataSource="dataSource"
        :scroll="{ x: 250, y: 520 }"
      >
        <div slot="title">
          <div class="title">{{ title }}</div>
          <div class="sub-title">
            <div>填报单位：{{ model.departName }}</div>
            <div>{{ model.year }}年（{{ model.quarter }}季）度</div>
            <div>审计负责人：{{ model.headName }}</div>
            <div>填表人：{{ model.realName }}</div>
            <div>填表时间：{{ model.addDate }}</div>
            <div>金额单位（万元）</div>
          </div>
        </div>
        <template slot="customTitle">
          <div class="header-title">单位详细名称</div>
        </template>
        <template slot="name" slot-scope="name">
          <div style="width: 100%; height: 45px; overflow-x: hidden; overflow-y: auto">{{ name }}</div>
        </template>
        <template slot="certificateType" slot-scope="certificateType">
          <div style="width: 100%; height: 45px; overflow-x: hidden; overflow-y: auto">{{ certificateType }}</div>
        </template>
        <template slot="certificateType1" slot-scope="certificateType1">
          <div style="width: 100%; height: 45px; overflow-x: hidden; overflow-y: auto">{{ certificateType1 }}</div>
        </template>
        <template slot="honor" slot-scope="honor">
          <div style="width: 100%; height: 45px; overflow-x: hidden; overflow-y: auto">{{ honor }}</div>
        </template>
        <template slot="honor1" slot-scope="honor1">
          <div style="width: 100%; height: 45px; overflow-x: hidden; overflow-y: auto">{{ honor1 }}</div>
        </template>
        <template slot="system" slot-scope="system">
          <div style="width: 100%; height: 45px; overflow-x: hidden; overflow-y: auto">{{ system }}</div>
        </template>
        <template slot="system1" slot-scope="system1">
          <div style="width: 100%; height: 45px; overflow-x: hidden; overflow-y: auto">{{ system1 }}</div>
        </template>
        <template slot="paper" slot-scope="paper">
          <div style="width: 100%; height: 45px; overflow-x: hidden; overflow-y: auto">{{ paper }}</div>
        </template>
        <template slot="paper1" slot-scope="paper1">
          <div style="width: 100%; height: 45px; overflow-x: hidden; overflow-y: auto">{{ paper1 }}</div>
        </template>
        
        <template slot="workYear" slot-scope="workYear, record">
          <div>{{ isNaN(Number(workYear)) ? workYear : record.workYear_dictText }}</div>
        </template>

        <template slot="auditPeriod" slot-scope="auditPeriod, record">
          <div>{{ isNaN(Number(auditPeriod)) ? auditPeriod : record.auditPeriod_dictText }}</div>
        </template>
      </a-table>
      <FileTag :apiId="apiId"></FileTag>
    </div>
  </j-modal>
</template>
<script>
import { httpAction, getAction } from '@/api/manage'
import columns from './columns'
import FileTag from '../../components/FileTag'

export default {
  name: 'CheckAndEditModel',
  components: {
    FileTag,
  },
  data() {
    return {
      disableSubmit: false,
      columns: columns(this),
      dataSource: [],
      title: '',
      visible: false,
      isCheck: false,
      model: {
        id: '',
        principal: '',
        preparer: '',
        date: '',
      },
      url: {
        list: '/sjxxzhbb/sjAuditInfo/getAuditInfoDetails',
      },
      apiId: '',
    }
  },
  created() {},
  methods: {
    check(record) {
      this.model = Object.assign({}, record)
      this.visible = true
      this.list()
    },
    list() {
      getAction(this.url.list, {
        id: this.model.id,
      }).then((res) => {
        if (res.success && res.result) {
          this.apiId = res.result[0].fileId
          this.dataSource = res.result[0].mapInfo
        } else {
          console.log(res)
        }
      })
    },
    close(isSubmit) {
      if (isSubmit) {
      } else {
        this.visible = false
      }
    },
  },
}
</script>

<style lang="less" scoped>
// @import '../../css/checkAndEdit.less';
@import '../css/baobiaotable.less';

.table-header {
  margin-bottom: 10px;

  .table-title {
    font-weight: bold;
    margin-left: 15px;
  }
}
.edit-list {
  .header-title {
    line-height: 108px;
  }
}
</style>
